home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / d86.arc / DEMO.DOC < prev    next >
Encoding:
Text File  |  1986-08-27  |  11.5 KB  |  195 lines

  1. ---DEMO.DOC---
  2.  
  3. To demonstrate some of the powers of D86, let's walk through a D86 session.  You
  4. should print out a copy of this file, DEMO.DOC, and also the file HEXOUT.8.
  5. Using those listings, go through the following steps.  You may wish to check
  6. them off as you go through them, to keep track of where you are.
  7.  
  8. 1. Make sure your current directory contains all the files A86.COM, D86.COM,
  9.    and HEXOUT.8.
  10.  
  11. 2. Assemble the HEXOUT program by typing the command A86 HEXOUT.8.  The A86
  12.    assembler will create the files HEXOUT.COM and HEXOUT.SYM.  Look over the
  13.    listing of the program, to get acquainted with what it does.
  14.  
  15. 3. Now comes the moment of truth, especially if you do not have a real IBM-PC.
  16.    Find out if the debugger works on your machine, by typing the command
  17.    D86 HEXOUT 41 42 5A.
  18.  
  19.    If all goes well, the screen should blank; and the D86 debugger screen
  20.    should appear.  The blinking cursor should be at the bottom left.  A sign-on
  21.    message should appear at the upper right.  A disassembly of the HEXOUT
  22.    program should be in the upper left.  The label HEXOUT should appear on the
  23.    first line, followed on the second line by the address 0100 and the
  24.    instruction MOV SI,TAIL_BUFF.  To the left of the address should be a
  25.    reverse-video pound sign.  If you don't see all of these things, refer to
  26.    the file TROUBLE.DOC to initiate actions to let me know how I might fix the
  27.    problem.
  28.  
  29. 4. Let's look at what we already have.  Notice the display of register values
  30.    in the lower left corner.  The values are all 4-digit hexadecimal.  At the
  31.    top of the second column of registers is a sequence of lower-case letters.
  32.    This is the flags display.  Each small letter stands for a flag whose value
  33.    is currently TRUE.  The flags settings are those that were handed to D86 by
  34.    the operating system starting the program; for MSDOS V3,1, the settings are
  35.    "i z e".  That display indicates that the interrupt flag "i", the zero flag
  36.    "z", and the parity-even flag "e" are all TRUE; the other flags are FALSE.
  37.    To the right of the registers are six lines labelled 1: through 6:.  These
  38.    are the memory window lines.  Since you haven't specified any memory windows
  39.    yet, they contain nothing but their numbers.  Below the memory-window lines
  40.    is a line labelled 0:.  This is the stack display line. The number 0: gives
  41.    the number of words on the stack, currently zero because nothing has been
  42.    pushed onto the stack.
  43.  
  44. 5. Observe that the sign-on message tells you to press Alt-F10 for help.  Do
  45.    so (that is, hold down the Alt-key while pressing the F10 key).  You are now
  46.    in help-mode, where you will remain until you press Alt-F10 again.  D86 will
  47.    keep changing the help-window, depending on what it thinks you are doing.
  48.    Right now you have a summary of the main function-keys, plus a few other
  49.    things.  Press F10 (without the Alt), and you'll get a summary of one-letter
  50.    debugger commands.  Press F10 a second time to return to the function-key
  51.    help screen.
  52.  
  53. 6. Let's try an immediate assembly-language instruction. Press the "M" key.
  54.    Note that the reverse-video block jumps from the pound-sign within the
  55.    disassembly, down to the line just above the blinking cursor.  The block is
  56.    the debugger's cursor; the blinking cursor is the program's console output
  57.    cursor.  The debugger does not use the blinking cursor because we do not
  58.    want the program's output to interfere with the debugger's output.  Also
  59.    note that the help-window is now telling you that you are typing in an
  60.    assembly-language line.
  61.  
  62. 7. Complete the line MOV AX,123.  The debugger immediately executes the assembly
  63.    language line you just typed, setting the register AX.  Note that you did
  64.    not have to learn a debugger command for setting registers; if you know A86,
  65.    you already know how to set registers!  The value of AX is now 007B, which
  66.    may surprise you if you expected 0123. A86's default base is 10, so 123 was
  67.    taken as decimal; which is hex 7B.  Type MOV AX,0123 instead, to get a value
  68.    of hex 123.
  69.  
  70. 8. Let's now play with the flags display.  Type the line ADD AL,05D, which
  71.    changes AL (the last two digits of AX) to hex 80, and alters the flags to "o
  72.    is a ". The interrupt flag is still on; but zero and parity-even are now
  73.    off.  They have been replaced by "o" overflow, "s" sign, and "a" auxiliary
  74.    carry.
  75.  
  76. 9. Type the line consisting of just CMC.  This is the Complement Carry
  77.    instruction.  Observe that the "c" appears.  Notice also that the CMC that
  78.    you typed remains on the screen.  Notice on the help window the entry "F3
  79.    RepeatCmd".  This tells you that the F3 key will repeat the last line-command
  80.    (not function-key) that you typed.  Press F3 several times, to see the
  81.    carry flag toggle on and off.  Isn't that the cleanest flags display you've
  82.    ever seen?
  83.  
  84. 10. Let's single-step an instruction.  Press the F1 key.  This executes the
  85.    program instruction, loading the SI register with TAIL_BUFF.  The disassembly
  86.    cursor moves down to the next instruction.  Observe that SI has changed to
  87.    0081, which is the pointer to the invocation command-tail, which should
  88.    contain the string typed after HEXOUT: " 41 42 5A" followed by a carriage-
  89.    return code (hex 0D).
  90.  
  91. 11. Let's examine memory to verify that last assertion.  Press the "1" key.
  92.    The cursor jumps to the start of memory-window 1, and the help-window gives
  93.    you a huge choice of memory types to display.  The entry "BtyeHex 2" tells us
  94.    that "B" will cause hex bytes to be displayed.  The "2" indicates that the
  95.    display occupies a fixed number of display bytes for every memory unit,
  96.    namely 2 hex digits.  Type B followed by a comma, to indicate that you want
  97.    nothing but hex bytes to be displayed.  Now the help window asks for a
  98.    segment location.  Let's use the DS register: type DS followed by a comma.
  99.    Now the help window wants an offset within the segment: type SI.  Before
  100.    typing the terminating ENTER, backspace-out what you have typed, and watch
  101.    the help-windows regress appropriately.  Isn't that impressive?  Now retype
  102.    the line, "B,DS,SI".  Note that when you press ENTER, the line fills out
  103.    with hex values: 20 34 31 20 34 32 20 35 41 0D etc.  (61 instead of 41 is
  104.    OK; it means you typed the invocation in lower-case.)
  105.  
  106. 12. Let's look at the same line, displayed as text.  Type "2", moving to memory
  107.    line 2, then type the line "T,SI".  This time you specified type T for text,
  108.    and you left out the segment-register specification.  D86 uses DS when you
  109.    leave out the segment register; so in this case you'll get the same segment.
  110.    This time the display starts with "41 42 5AM"; the "M" is the carriage-
  111.    return, which is control-M, ambiguously displayed.  You can read MEMORY.DOC
  112.    later on for descriptions of all the types, including other text types
  113.    allowing non-ambiguous displays.
  114.  
  115. 13. Let's execute the next instruction, CALL GET_HEX.  Here we have a choice,
  116.    between executing the procedure all at once, or stepping into the procedure
  117.    to execute its instructions one at a time.  Let's try stepping in first:
  118.    type the F1 key.  The cursor jumps to location GET_HEX, on the same
  119.    disassembly screen.  The SP register decrements from FFFE to FFFC, and
  120.    a value 0106 appears on the stack.  This is the return address, pointing
  121.    to the instruction following CALL GET_HEX.
  122.  
  123. 14. Watch memory lines 1 and 2 as you press F1 again, single-stepping the LODSB
  124.    instruction.  You had set up the lines to be pointed to by SI.  Since SI
  125.    changes when LODSB is executed, the memory-displays advance to the next byte.
  126.    Note that the AL register contains the value hex 20, a blank.
  127.  
  128. 15. In a normal debugging session, we would continue stepping within GET_HEX,
  129.    but let's not do that right now.  Instead, press the F6 "TrapRet" key, which
  130.    starts the program going, trapping at the return address on top of the stack,
  131.    which was 0106.  The cursor jumps back up to location 0106, the value is
  132.    no longer on the stack, and SI and the memory-displays have advanced to 0084.
  133.  
  134. 16. Let's try the classic "G" command, common to all debuggers.  Type the line
  135.    "G,0103", noticing the help-windows as you go along.  After you press ENTER,
  136.    the program runs until it gets back to the trap address you provided, 0103.
  137.    Note that the program has called OUT_VALUE to output the "A" that corresponds
  138.    to your input hex 41.  The "A" appears on the bottom line, and the blinking
  139.    cursor advances.
  140.  
  141. 17. Let's execute the next CALL GET_HEX all at once, by pressing the F2 ProcStep
  142.    key.  SI advances again, and AL is loaded with the next value 42.
  143.  
  144. 18. Notice that the disassembly is symbolic: the display is CALL GET_HEX, not
  145.    CALL 0112 as lesser debuggers might give you.  Let's try symbolic input:
  146.    type the line "B,HEX_DIGIT?", causing the debugger to set a fixed trap at
  147.    location HEX_DIGIT?.  Now set your program running with a simple G followed
  148.    by the ENTER key.  The program traps at HEX_DIGIT?. Since this location is
  149.    not in the disassembly window, the window is regenerated, and the cursor
  150.    placed at HEX_DIGIT?.  The memory displays now point to the final number
  151.    "5A".
  152.  
  153. 19. Press F3 to repeat the G-command.  The program traps at HEX_DIGIT? again,
  154.    with SI advanced to the "A".  Press F3 again; advancing SI to the final
  155.    carriage-return.
  156.  
  157. 20. Press F3 yet again.  Since HEX_DIGIT? is never reached again, the program
  158.    runs to its completion.  D86 automatically traps at the EXIT instruction:
  159.    in this case, it is INT 021 with the AH register set to hex 4C, the function
  160.    number for EXIT.  If we try to start the program again from here, we will
  161.    be frozen here: we must issue the Q command to exit the session.  Don't
  162.    do it yet, though.
  163.  
  164. 21. Before exiting, let's check out HEX_DIGIT? more thoroughly.  First, we
  165.    clear the breakpoint we set, by typing "B" followed by the ENTER key.
  166.  
  167. 22. Type the command line "J 0200", jumping to a scratch-pad memory area.  Then
  168.    press the F7 key, entering Patch Memory mode.  The cursor moves into the
  169.    disassembled instruction, signalling that whatever you type is clobbering
  170.    it.
  171.  
  172. 23. Type in the lines "INC BL", "MOV AL,BL", and "JMP HEX_DIGIT?".  Press ENTER
  173.    at the beginning of the fourth line, exiting Patch Memory mode.  The cursor
  174.    will return to the left of the 0200 INC BL line.
  175.  
  176. 24. Type the immediate command "MOV BL,'0'-2".  The BL register should change
  177.    to the evaluated value, hex 2E.
  178.  
  179. 25. Execute the patch-subroutine by typing the line "CALL 0200".  The value BL
  180.    increments to 2F, which is one less than the lowest digit, '0'.  The
  181.    Carry flag is set, indicating that HEX_DIGIT? has correctly judged 2F not
  182.    to be a hex digit.  Now press F3 repeatly, executing your patched subroutine
  183.    for each decimal digit.  The "c" will disappear as the values advance; and
  184.    AL will hold the correct binary value for each hex digit BL.  When BL reaches
  185.    3A, the "c" comes back on again, indicating that we are beyond the decimal
  186.    digits.  When BL reaches 41, "c" goes off, and AL values of 10 through 15
  187.    are displayed.  When BL reaches "47" "c" comes on yet again, because G is
  188.    not a decimal digit.  Type "MOV BL,05F", followed by "CALL 0200", followed
  189.    by F3 several more times to verify correct action for the range of lower-
  190.    case 'a' through 'f'.  You have, relatively quickly, done a thorough test of
  191.    HEX_DIGIT?.  How long would that have taken on a lesser debugger?
  192.  
  193. 26. Type Q followed by ENTER to exit the debugger.
  194.  
  195.